﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter7.Section4
{
    public class Example01
    {
        public Example01()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double[], double[]> ff
                = new V.Function.ToLastType<double[], double[]>(func);
            V.Surface s = new V.Surface(ff);
            s.Parameter1StartValue = 0.0;
            s.Parameter1EndValue = 2.0 * Math.PI;
            s.Parameter2StartValue = 0.0;
            s.Parameter2EndValue = 1.0;
            result += s.Area.ToString() + "\r\n";

            double res = Math.Sqrt(2.0)*Math.PI;
            result += res.ToString() + "\r\n";
        }
        private double[] func(double[] u)
        {
            double[] x = new double[3];
            x[0] = u[1] * Math.Cos(u[0]);
            x[1] = u[1] * Math.Sin(u[0]);
            x[2] = u[1];
            return x;
        }
    }
}
/*
4.442892864163
4.44288293815837
*/